gtk: focus out the GtkIMContextWayland upon finalization.
authorJehan <jehan@girinstud.io>
Mon, 29 Jun 2020 20:12:53 +0000 (22:12 +0200)
committerJehan <jehan@girinstud.io>
Mon, 29 Jun 2020 20:17:08 +0000 (22:17 +0200)
In particular, it will NULL-ified the current global context if this is
the finalized one, avoiding dangling invalid pointers.

Would have been a cherry-pick from branch gtk-3-24 of commit
b592ded80ad4825d115317ba6750a086da0434c0, but files moved.

gtk/gtkimcontextwayland.c

index 658e6e7f7bf2db30f03aa07c0b6fa830307054ef..f76f183fd2e052e475b5d3eab0c7b3361ce75f5c 100644 (file)
@@ -93,6 +93,8 @@ struct _GtkIMContextWayland
   guint use_preedit : 1;
 };
 
+static void gtk_im_context_wayland_focus_out (GtkIMContext *context);
+
 G_DEFINE_TYPE_WITH_CODE (GtkIMContextWayland, gtk_im_context_wayland, GTK_TYPE_IM_CONTEXT_SIMPLE,
                         gtk_im_module_ensure_extension_point ();
                          g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
@@ -476,6 +478,8 @@ gtk_im_context_wayland_finalize (GObject *object)
 {
   GtkIMContextWayland *context = GTK_IM_CONTEXT_WAYLAND (object);
 
+  gtk_im_context_wayland_focus_out (GTK_IM_CONTEXT (context));
+
   g_clear_object (&context->widget);
   g_clear_object (&context->gesture);
   g_free (context->surrounding.text);